# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
#   include csns::dgganglia
class csns::dgganglia 
{
#		 $globals_deaf			  = 'no'
	
#	package {'ganglia-gmond':
#		ensure => installed,
#		}	
        $login= ['slurm1','slurm2','login1','login2',] 		
	$public= ['node1','node2','node3','node4','node5','node6','node7','node8','node9','node10','node11','node12','node13','node14','node15','node16','node17','node18','node19','node20','node21','node22','node23','node24','node25','node26','node27','node28','node29','node30','node31','node32','node77','node78','node79','node80','node81','node82','node83','node84','node85',]
        $neu= ['node33','node34','node35','node36','node37','node38','node39','node40','node41','node42','node43','node44','node45','node46','node47','node48','node69','node70','node71','node72','node73','node74','node75','node76',]
        $neuinstr= ['node49','node50','node51','node52','node53','node54','node55','node56','node57','node58','node59','node60','node61','node62',]
	$shortjob= ['node63','node64','node65','node66','node67','node68',]
	$apg=['node86','nod87','node88','node89','node90','node91','node92','node93','node94','node95','node96','node97','node98','node99','node100','node101','node102','node103','node104','node105','node106','node107','node108','node109','node110','node111','node112','node113','node114','node115',]
	$acc=['node116','node117','node118','node119','node120','node121','node122','node123','node124','node125','node126','node127','node128','node129','node130','node131','node132','node133','node134','node135','node136','node137','node138','node139','node140','node141','node142','node143','node144','node145','node146','node147','node148','node149',]       
	$gpu=['gnode1',]
	$wnssim=['wns03','wns04','wns05','wns06','wns07','wns08','wns09','wns10','wns11','wns12','wns13','wns14','wns15','wns16','wns17',]


    if $hostname in $login {
	class {'ganglia::gmond':
                 globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'HPC-Login',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.21', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }
	}

    if $hostname in $public {
	 class {'ganglia::gmond':
                 globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'HPC',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.31', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }	
	}    
   
    if $hostname in $neu {
    
		class {'ganglia::gmond':
		globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'NEU',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.63', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
		} 
    }

    if $hostname in $neuinstr {
	class {'ganglia::gmond':
                globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'NeuInstr',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.79', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }
	}

    if $hostname in $acc {
	class {'ganglia::gmond':
                globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'ACC',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.146', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,

                }
	}     
    
    if $hostname in $apg{
	class {'ganglia::gmond':
                 globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'APG',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.116', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }
	}

    if $hostname in $gpu{
	class {'ganglia::gmond':
		#gpu                             => true,
                 globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'GPU',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.200', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }
	
#	file { "/etc/ganglia/conf.d/modpython.conf":
#                ensure  => present,
#                owner   => 'root',
#                group   => 'root',
#                mode    => '0644',
#                source  => "puppet:///modules/${module_name}/modpython.conf",
#                }
	}

    if $hostname in $shortjob{
	class {'ganglia::gmond':
                globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'ShortJob',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.232.93', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }
	}

    if $hostname in $wnssim {
	class {'ganglia::gmond':
                 globals_deaf                     => 'no',
                  globals_host_dmax                =>'86400',
                  globals_send_metadata_interval   => '30',
                  globals_override_hostname        => undef,
                  cluster_name                     => 'wnssim',
                  cluster_owner                    => 'csns',
                  cluster_latlong                  => 'unspecified',
                  cluster_url                      => 'unspecified',
                  host_location                    => 'csns',
                  udp_send_channel                 => [
                    { host => '10.1.252.103', port => 8649, ttl => 1 }
                  ],
                  udp_recv_channel                 => [
                    { port => 8649 }
                  ],
                  tcp_accept_channel               => [ { port => 8649 } ],
                  gmond_package_name               => $::ganglia::params::gmond_package_name,
                }
	}

}


#class csns::dgganglia::service{
#	service{'gmond':
#          ensure => running,
#          enable => true,
#          hasstatus => true,
#          hasrestart => true,
#          }
#}
